<?php
/*
	分销中心
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['ischecklogin']=cfc('core')->checklogin('','',true);
	$member=model('jy_commission/member')->checkmember('',true);
	$return['setting']=plugin('jy_commission')->plugin_setting('buhuo');
	$basic=model('core/member')->basic($_SESSION['uid']);
	$member=array_merge($member,$basic);
	if($member['agent_id']){
		$member['agent']=model('core/member')->basic($member['agent_id']);
	}else{
		$member['agent']=array('nickname'=>'总店');
	}
	if($member['level_id']){
		$member['level']=pdo_getcolumn('jy_commission_level',array('id'=>$member['level_id']),'title');
	}else{
		$member['level']='默认等级';
	}
	$return['member']=$member;
	$data=array();
	$params=array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']);
	$data['lasttotal']=pdo_getsum('jy_buhuo_goods',$params,'total');
	$data['alltotal']=pdo_getsum('jy_buhuo_goods',$params,'alltotal');
	$data['allfee']=pdo_getsum('jy_buhuo_order',$params,'price');
	$params['plugin_name']='jy_weishop';
	$data['goods_total']=pdo_getsum('jy_buhuo_goods',$params,'total');
	$data['goods_alltotal']=pdo_getsum('jy_buhuo_goods',$params,'alltotal');
	$data['goods_ordernum']=pdo_count('jy_buhuo_order',$params,'id');
	$data['goods_orderfee']=pdo_getsum('jy_buhuo_order',$params,'price');
	$params['plugin_name']='jy_onlineedu';
	$data['edu_total']=pdo_getsum('jy_buhuo_goods',$params,'total');
	$data['edu_alltotal']=pdo_getsum('jy_buhuo_goods',$params,'alltotal');
	$data['edu_ordernum']=pdo_count('jy_buhuo_order',$params,'id');
	$data['edu_orderfee']=pdo_getsum('jy_buhuo_order',$params,'price');
	$return['data']=$data;
	set_html('title',$return['setting']['title']?:'进销中心');
	exi($return);
}
?>